package zestaw4.klonowanie_obiektow;

/**
 * Author: Daniel
 * Date: 03.08.13
 */

public class B implements Cloneable {
    private int[] arr = {1, 2, 3};

    public int[] getArr() {
        return arr;
    }

    public void set(int i, int val) {
        arr[i] = val;
    }

    @Override
    public Object clone() {
        try {
            B copy = (B) super.clone();
            copy.arr = (int[]) arr.clone();
            return copy;
        } catch (CloneNotSupportedException e) {
            throw new Error("Dziękujemy za klonowanie!");
        }
    }
}
